import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import top.aiprogram.controller.UserController;
import top.aiprogram.entity.User;
import top.aiprogram.entity.UserFather;
import top.aiprogram.service.UserService;

public class Main {
    public static void main(String[] args) {
        //加载spring
//        ApplicationContext context = new ClassPathXmlApplicationContext("./top/aiprogram/resource/application-context.xml");
//        User user =  (User)context.getBean("user");
//        System.out.println(user.getId());
//        System.out.println(user.getName());
//        for(String u : user.getList()){
//            System.out.println(u);
//        }

        ApplicationContext context1 = new ClassPathXmlApplicationContext("./top/aiprogram/resource/application-context.xml");
//        UserFather userFather = (UserFather) context1.getBean(UserFather.class);
//        System.out.println( userFather.getFatherName());
//        System.out.println( userFather.getUser().toString());


        UserController userController = context1.getBean(UserController.class);
        UserService service = userController.getUserService();
        service.say("laowang");
    }
}
